#!/bin/bash

TESTNAMES=`ls dt/test_*.dt`
cd $BINDIR
for testname in $TESTNAMES
do
	testname=`basename $testname`
	# compiling
	mkdir -p ../tmp
	java frontend/Compiler -d ../tmp --data-path ../userdata/datapath ../$DTDIR/$testname
	cd ..
	cp tmp/*.java src/daytrader/strategy/
	make daytrader > /dev/null
	cd $BINDIR

        # test running the compiled strategies
        echo -n "Compiling $testname"
        
	if java daytrader/framework/MockEngine &> /dev/null
        then
           echo "   ...............OK!"
        else
           echo "   ...............FAIL!!!!"
        fi
	
	# clean up the tmp folder
	rm -rf ../tmp
done
